package collection;

import java.util.Objects;

public class Dog extends Animal{
    int age;
    String name;

    Dog(){}

    public void eat(){
        System.out.println("Dog.eat");
    }

    @Override
    public void sleep() {
        System.out.println("Dog.sleep");
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Dog dog = (Dog) o;
        return age == dog.age && Objects.equals(name, dog.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(age, name);
    }

    @Override
    public String toString() {
        return "Dog [age=" + age + ", name=" + name + "]";
    }
}
